#ifndef _BUFF_H_
#define _BUFF_H_

#ifdef _WIN32
#pragma once
#endif

/**
 * 06/03/12 - Steven Hartin - Initial creation
 */
class CBuff;

#include <string>

#include "entity.h"
#include "timer.h"
#include "player.h"

using std::string;

typedef enum buffState
{
    BUFF_TYPE_BUFF = 0x01,
    BUFF_TYPE_DEBUFF = 0x02,
    BUFF_TYPE_INDEFINITE = 0x04
} BUFF_STATE;

class CBuff
{
public:
    CBuff(const ENTITY_ID &nId=ENT_BUFF_NONE,
          const string &szBuffName="buff_none",
          const BUFF_STATE &nBuffState=BUFF_TYPE_BUFF);

    bool isActive() const;

    double getTimeRemaining() const;
    CTimer getEndTime() const;
    void setBuffTime(double dTimeTaken);

    bool start(CPlayer *pPlayer);
    bool stop(CPlayer *pPlayer);

    const string &getBuffName() const;

    virtual bool applyBuff(CPlayer *pPlayer) = 0;
    virtual bool removeBuff(CPlayer *pPlayer) = 0;

    const BUFF_STATE getBuffState() const;

    const ENTITY_ID getId() const;

private:
    const BUFF_STATE m_nBuffState;
    bool m_bActive;
    CTimer m_timeBuffStarted;
    double m_dTimeTaken;
    const string m_szBuffName;
    const ENTITY_ID m_nId;
};

#endif